#include<iostream>
#include<sys/eventfd.h>
#include<unistd.h>
int main()
{
    int initial = 0;
    int fd = eventfd(initial, EFD_CLOEXEC|EFD_NONBLOCK);
    if(fd < 0){
        perror("eventfd");
        return -1;
    }
    uint64_t val = 2;
    write(fd,&val,sizeof(val));
    val = 8;
    write(fd, &val, sizeof(val));
    uint64_t res = 0;
    read(fd,&res,sizeof(res));
    std::cout << "res:" << res << std::endl;
    close(fd);
    return 0;
}